home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Xconq 7.0d37 / source / kernel / vms.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-12  |  2.9 KB  |  155 lines  |  [TEXT/KAHL]

  1. /* VMS stuff.
  2.    Copyright (C) 1992, 1993, 1994, 1995 Stanley T. Shebs.
  3.  
  4. Xconq is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.  See the file COPYING.  */
  8.  
  9. #include "conq.h"
  10.  
  11. #include <signal.h>
  12.  
  13. /* #include <sys/time.h> */
  14.  
  15. #ifndef XCONQLIB
  16. #define XCONQLIB "[-.lib]"
  17. #endif
  18.  
  19. char *
  20. default_library_filename()
  21. {
  22.     return XCONQLIB;
  23. }
  24.  
  25. char *
  26. news_filename()
  27. {
  28.     make_pathname(xconqlib, NEWSFILE, "", spbuf);
  29.     return spbuf;
  30. }
  31.  
  32. char *
  33. save_filename()
  34. {
  35.     return "save.xconq";
  36. }
  37.  
  38. char *
  39. checkpoint_filename()
  40. {
  41.     return "check.xconq";
  42. }
  43.  
  44. char *
  45. error_save_filename()
  46. {
  47.     return "errorsave.xconq";
  48. }
  49.  
  50. char *
  51. statistics_filename()
  52. {
  53.     return "stats.xconq";
  54. }
  55.  
  56. /* Attempt to open a library file. */
  57.  
  58. FILE *
  59. open_module_library_file(module)
  60. Module *module;
  61. {
  62.     FILE *fp = NULL;
  63.  
  64.     /* Don't try to do on anon modules? */
  65.     if (module->name == NULL)
  66.       return NULL;
  67.     /* Generate library pathname. */
  68.     make_pathname(xconqlib, module->name, "g", spbuf);
  69.     /* Now try to open the file. */
  70.     if ((fp = fopen(spbuf, "r")) != NULL) {
  71.     /* Remember the filename where we found it. */
  72.     module->filename = copy_string(spbuf);
  73.     }
  74.     return fp;
  75. }
  76.  
  77. FILE *
  78. open_module_explicit_file(module)
  79. Module *module;
  80. {
  81.     if (module->filename == NULL)
  82.       return NULL;
  83.     return (fopen(module->filename, "r"));
  84. }
  85.  
  86. FILE *
  87. open_library_file(filename)
  88. char *filename;
  89. {
  90.     FILE *fp = NULL;
  91.  
  92.     /* Generate library pathname. */
  93.     make_pathname(xconqlib, filename, NULL, spbuf);
  94.     /* Now try to open the file. */
  95.     if ((fp = fopen(spbuf, "r")) != NULL) {
  96.     }
  97.     return fp;
  98. }
  99.  
  100. make_pathname(path, name, extn, pathbuf)
  101. char *path, *name, *extn, *pathbuf;
  102. {
  103.     strcpy(pathbuf, "");
  104.     if (!empty_string(path)) {
  105.     strcat(pathbuf, path);
  106.     }
  107.     strcat(pathbuf, name);
  108.     /* Don't add a second identical extension, but do add if extension
  109.        is different (in case we want "foo.12" -> "foo.12.g" for instance) */
  110.     if (strrchr(name, '.')
  111.     && extn
  112.     && strcmp(strrchr(name, '.')+1, extn) == 0)
  113.       return;
  114.     if (!empty_string(extn)) {
  115.     strcat(pathbuf, ".");
  116.     strcat(pathbuf, extn);
  117.     }
  118. }
  119.  
  120. /* Remove a saved game from the system. */
  121.  
  122. remove_saved_game()
  123. {
  124. }
  125.  
  126.  
  127. init_sighandlers()
  128. {
  129. #if 0
  130.     signal(SIGINT, stop_handler);
  131.     if (0 /* don't accidently quit */ && !Debug) {
  132.     signal(SIGINT, SIG_IGN);
  133.     } else {
  134.     signal(SIGINT, SIG_DFL);
  135. /*    signal(SIGINT, crash_handler);  */
  136.     }
  137.     signal(1, crash_handler);
  138.     signal(SIGHUP, hup_handler);
  139.     signal(SIGBUS, crash_handler);
  140.     signal(SIGSEGV, crash_handler);
  141.     signal(SIGFPE, crash_handler);
  142.     signal(SIGILL, crash_handler);
  143.     signal(SIGSYS, crash_handler);
  144.     signal(SIGINT, crash_handler);
  145.     signal(SIGQUIT, crash_handler);
  146.     signal(SIGTERM, crash_handler);
  147. #endif
  148. }
  149.  
  150. int n_seconds_elapsed(n)
  151. int n;
  152. {
  153.     return FALSE;
  154. }
  155.